$(function () {
    $('.am-header-title').text('联系我们');


    function showalert(txt) {
        $("#modal-alert").find(".am-modal-bd").text(txt)
            .end()
            .modal("open");
    }


    var user = JSON.parse(localStorage.getItem("user"));

    $("#lswm").click(function () {
        var url = "/h5/submitContactUs";

        var doType = $("input[name=doType]:checked").val();
        var name = $("#name").val();
        var email = $("#email").val();
        var phone = $("#phone").val();


        if (name == null || name == "") {
            showalert("姓名不能为空");
            return false;
        }

        if (email == null || email == "") {
            showalert("邮箱不能为空");
            return false;
        }

        if (phone == null || phone == "") {
            showalert("联系方式不能为空");
            return false;
        }


        $.post(url, {
            name: name,
            email: email,
            phone: phone,
            account: user.account,
            doType: doType

        }, function (result) {
            if (result.code == '000000') {
                showalert("提交成功");
                window.location.href="../../app/settings/settings.jsp";
            } else {
                showalert("提交失败");
            }
        })

    });


});

